package ch5;

import java.util.Scanner;

public class DigitalSum {

	public static void main(String[] args) {
		// 输入一个正整数，求他各位上的和，判断这个数能不能被他各位上的和整除
		Scanner in = new Scanner(System.in);
		int num = 0;
		do {
			System.out.print("请输入一个正整数：");
			num = in.nextInt();
		} while (num <= 0);
		int k = num;
		int he = 0;
		while (k > 0) {
			he += k % 10;
			k /= 10;
		}
		// System.out.println("num=" + num + ",he=" + he);
		System.out.println(num % he == 0 ? "可以整除" : "不能整除");

		// if(num%he==0){
		// System.out.println("能整除");
		// }else{
		// System.out.println("不能整除");
		// }
	}

}
